package petrochina.company.electric.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Objects;

/**
 * 任务申请线路数据
 */
public class TaskApplyEquipData implements Parcelable {

    // id
    private long id;
    private int type;
    private String equipCode;
    private String equipName;
    private int status;
    private String createTime;

    // 用户状态 0：工人 1：管理员

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getEquipCode() {
        return equipCode;
    }

    public void setEquipCode(String equipCode) {
        this.equipCode = equipCode;
    }

    public String getEquipName() {
        return equipName;
    }

    public void setEquipName(String equipName) {
        this.equipName = equipName;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public static Creator<TaskApplyEquipData> getCREATOR() {
        return CREATOR;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.id);
        dest.writeInt(this.type);
        dest.writeString(this.equipCode);
        dest.writeString(this.equipName);
        dest.writeInt(this.status);
        dest.writeString(this.createTime);
    }

    public void readFromParcel(Parcel source) {
        this.id = source.readLong();
        this.type = source.readInt();
        this.equipCode = source.readString();
        this.equipName = source.readString();
        this.status = source.readInt();
        this.createTime = source.readString();
    }

    public TaskApplyEquipData(long id, int type, String equipCode, String equipName, int status, String createTime) {
        this.id = id;
        this.type = type;
        this.equipCode = equipCode;
        this.equipName = equipName;
        this.status = status;
        this.createTime = createTime;
    }

    protected TaskApplyEquipData(Parcel in) {
        this.id = in.readLong();
        this.type = in.readInt();
        this.equipCode = in.readString();
        this.equipName= in.readString();
        this.status = in.readInt();
        this.createTime = in.readString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TaskApplyEquipData)) return false;
        TaskApplyEquipData that = (TaskApplyEquipData) o;
        return getEquipName().equals(that.getEquipName());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getType(), getEquipCode(), getEquipName(), getStatus(), getCreateTime());
    }

    public static final Creator<TaskApplyEquipData> CREATOR = new Creator<TaskApplyEquipData>() {
        @Override
        public TaskApplyEquipData createFromParcel(Parcel source) {
            return new TaskApplyEquipData(source);
        }

        @Override
        public TaskApplyEquipData[] newArray(int size) {
            return new TaskApplyEquipData[size];
        }
    };
}
